linalg_qr Module



Interfaces

public interface form_qr

  • private pure subroutine form_qr_no_pivot(r, tau, q)

    Forms the full M-by-M orthogonal matrix from the elementary reflectors returned by the base QR factorization algorithm.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(inout), dimension(:,:) :: r

    On input, an M-by-N matrix where the elements below the diagonal contain the elementary reflectors generated from the QR factorization. On and above the diagonal, the matrix contains the matrix . On output, the elements below the diagonal are zeroed such that the remaining matrix is simply the M-by-N matrix .

    real(kind=real64), intent(in), dimension(:) :: tau

    A MIN(M, N)-element array containing the scalar factors of each elementary reflector defined in .

    real(kind=real64), intent(out), dimension(:,:) :: q

    An M-by-M matrix where the full orthogonal matrix will be written. In the event that M > N, may be supplied as M-by-N, and therefore only return the useful submatrix as the factorization can be written as .

  • private pure subroutine form_qr_no_pivot_cmplx(r, tau, q)

    Forms the full M-by-M orthogonal matrix from the elementary reflectors returned by the base QR factorization algorithm.

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=real64), intent(inout), dimension(:,:) :: r

    On input, an M-by-N matrix where the elements below the diagonal contain the elementary reflectors generated from the QR factorization. On and above the diagonal, the matrix contains the matrix . On output, the elements below the diagonal are zeroed such that the remaining matrix is simply the M-by-N matrix .

    complex(kind=real64), intent(in), dimension(:) :: tau

    A MIN(M, N)-element array containing the scalar factors of each elementary reflector defined in .

    complex(kind=real64), intent(out), dimension(:,:) :: q

    An M-by-M matrix where the full orthogonal matrix will be written. In the event that M > N, may be supplied as M-by-N, and therefore only return the useful submatrix as the factorization can be written as .

  • private pure subroutine form_qr_pivot(r, tau, pvt, q, p)

    Forms the full M-by-M orthogonal matrix from the elementary reflectors returned by the base QR factorization algorithm.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(inout), dimension(:,:) :: r

    On input, an M-by-N matrix where the elements below the diagonal contain the elementary reflectors generated from the QR factorization. On and above the diagonal, the matrix contains the matrix . On output, the elements below the diagonal are zeroed such that the remaining matrix is simply the M-by-N matrix .

    real(kind=real64), intent(in), dimension(:) :: tau

    A MIN(M, N)-element array containing the scalar factors of each elementary reflector defined in .

    integer(kind=int32), intent(in), dimension(:) :: pvt

    An N-element column pivot array as returned by the QR factorization.

    real(kind=real64), intent(out), dimension(:,:) :: q

    An M-by-M matrix where the full orthogonal matrix will be written. In the event that M > N, may be supplied as M-by-N, and therefore only return the useful submatrix as the factorization can be written as .

    real(kind=real64), intent(out), dimension(:,:) :: p

    An N-by-N matrix where the pivot matrix will be written.

  • private pure subroutine form_qr_pivot_cmplx(r, tau, pvt, q, p)

    Forms the full M-by-M orthogonal matrix from the elementary reflectors returned by the base QR factorization algorithm.

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=real64), intent(inout), dimension(:,:) :: r

    On input, an M-by-N matrix where the elements below the diagonal contain the elementary reflectors generated from the QR factorization. On and above the diagonal, the matrix contains the matrix . On output, the elements below the diagonal are zeroed such that the remaining matrix is simply the M-by-N matrix .

    complex(kind=real64), intent(in), dimension(:) :: tau

    A MIN(M, N)-element array containing the scalar factors of each elementary reflector defined in .

    integer(kind=int32), intent(in), dimension(:) :: pvt

    An N-element column pivot array as returned by the QR factorization.

    complex(kind=real64), intent(out), dimension(:,:) :: q

    An M-by-M matrix where the full orthogonal matrix will be written. In the event that M > N, may be supplied as M-by-N, and therefore only return the useful submatrix as the factorization can be written as .

    complex(kind=real64), intent(out), dimension(:,:) :: p

    An N-by-N matrix where the pivot matrix will be written.

public interface mult_qr

  • private pure function mult_qr_mtx(lside, trans, a, tau, c) result(qc)

    Multiplies a general matrix by the orthogonal matrix from a QR factorization such that or .

    Arguments

    Type IntentOptional Attributes Name
    logical, intent(in) :: lside

    Set to true to apply or from the left; else, set to false to apply or from the right.

    logical, intent(in) :: trans

    Set to true to apply ; else, set to false to apply .

    real(kind=real64), intent(in), dimension(:,:) :: a

    On input, an LDA-by-K matrix containing the elementary reflectors output from the QR factorization. If lside is set to true, LDA = M, and M >= K >= 0; else, if lside is set to false, LDA = N, and N >= K >= 0.

    real(kind=real64), intent(in), dimension(:) :: tau

    A K-element array containing the scalar factors of each elementary reflector defined in.

    real(kind=real64), intent(in), dimension(:,:) :: c

    The M-by-N matrix .

    Return Value real(kind=real64), allocatable, dimension(:,:)

    The M-by-N product of and .

  • private pure function mult_qr_mtx_cmplx(lside, trans, a, tau, c) result(qc)

    Multiplies a general matrix by the orthogonal matrix from a QR factorization such that or .

    Arguments

    Type IntentOptional Attributes Name
    logical, intent(in) :: lside

    Set to true to apply or from the left; else, set to false to apply or from the right.

    logical, intent(in) :: trans

    Set to true to apply ; else, set to false to apply .

    complex(kind=real64), intent(in), dimension(:,:) :: a

    On input, an LDA-by-K matrix containing the elementary reflectors output from the QR factorization. If lside is set to true, LDA = M, and M >= K >= 0; else, if lside is set to false, LDA = N, and N >= K >= 0.

    complex(kind=real64), intent(in), dimension(:) :: tau

    A K-element array containing the scalar factors of each elementary reflector defined in.

    complex(kind=real64), intent(in), dimension(:,:) :: c

    The M-by-N matrix .

    Return Value complex(kind=real64), allocatable, dimension(:,:)

    The M-by-N product of and .

  • private pure function mult_qr_vec(trans, a, tau, c) result(qc)

    Multiplies a vector by the orthogonal matrix from a QR factorization such that .

    Arguments

    Type IntentOptional Attributes Name
    logical, intent(in) :: trans

    Set to true to apply ; else, set to false to apply .

    real(kind=real64), intent(in), dimension(:,:) :: a

    On input, an M-by-K matrix containing the elementary reflectors output from the QR factorization.

    real(kind=real64), intent(in), dimension(:) :: tau

    A K-element array containing the scalar factors of each elementary reflector defined in.

    real(kind=real64), intent(in), dimension(:) :: c

    The M-element vector .

    Return Value real(kind=real64), allocatable, dimension(:)

    The product of the orthogonal matrix and the original vector .

  • private pure function mult_qr_vec_cmplx(trans, a, tau, c) result(qc)

    Multiplies a vector by the orthogonal matrix from a QR factorization such that .

    Arguments

    Type IntentOptional Attributes Name
    logical, intent(in) :: trans

    Set to true to apply ; else, set to false to apply .

    complex(kind=real64), intent(in), dimension(:,:) :: a

    On input, an M-by-K matrix containing the elementary reflectors output from the QR factorization. Notice, the contents of this matrix are restored on exit.

    complex(kind=real64), intent(in), dimension(:) :: tau

    A K-element array containing the scalar factors of each elementary reflector defined in.

    complex(kind=real64), intent(in), dimension(:) :: c

    The M-element vector .

    Return Value complex(kind=real64), allocatable, dimension(:)

    The product of the orthogonal matrix and the original vector .

public interface qr_factor

  • private pure subroutine qr_factor_no_pivot(a, tau, qr, q, r)

    Computes the QR factorization of an M-by-N matrix.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in), dimension(:,:) :: a

    The M-by-N matrix to factor.

    real(kind=real64), intent(out), optional, allocatable, target, dimension(:) :: tau

    A MIN(M, N)-element array used to store the scalar factors of the elementary reflectors.

    real(kind=real64), intent(out), optional, allocatable, target, dimension(:,:) :: qr

    The M-by-N factored matrix stored such that the elements on and above the diagonal contain the MIN(M, N)-by-N upper trapezoidal matrix ( is upper triangular if M >= N). The elements below the diagonal, along with the array tau, represent the orthogonal matrix as a product of elementary reflectors.

    real(kind=real64), intent(out), optional, allocatable, target, dimension(:,:) :: q

    The M-by-M orthogonal matrix .

    real(kind=real64), intent(out), optional, allocatable, target, dimension(:,:) :: r

    The M-by-N upper trapezoidal matrix .

  • private pure subroutine qr_factor_no_pivot_cmplx(a, tau, qr, q, r)

    Computes the QR factorization of an M-by-N matrix.

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=real64), intent(in), dimension(:,:) :: a

    The M-by-N matrix to factor.

    complex(kind=real64), intent(out), optional, allocatable, target, dimension(:) :: tau

    A MIN(M, N)-element array used to store the scalar factors of the elementary reflectors.

    complex(kind=real64), intent(out), optional, allocatable, target, dimension(:,:) :: qr

    The M-by-N factored matrix stored such that the elements on and above the diagonal contain the MIN(M, N)-by-N upper trapezoidal matrix ( is upper triangular if M >= N). The elements below the diagonal, along with the array tau, represent the orthogonal matrix as a product of elementary reflectors.

    complex(kind=real64), intent(out), optional, allocatable, target, dimension(:,:) :: q

    The M-by-M orthogonal matrix .

    complex(kind=real64), intent(out), optional, allocatable, target, dimension(:,:) :: r

    The M-by-N upper trapezoidal matrix .

  • private pure subroutine qr_factor_pivot(a, jpvt, tau, qr, q, r, p)

    Computes the QR factorization of an M-by-N matrix using column pivoting such that .

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in), dimension(:,:) :: a

    The M-by-N matrix to factor.

    integer(kind=int32), intent(inout), dimension(:) :: jpvt

    On input, an N-element array that if JPVT(I) .ne. 0, the I-th column of A is permuted to the front of A * P; if JPVT(I) = 0, the I-th column of A is a free column. On output, if JPVT(I) = K, then the I-th column of A * P was the K-th column of A.

    real(kind=real64), intent(out), optional, allocatable, target, dimension(:) :: tau

    A MIN(M, N)-element array used to store the scalar factors of the elementary reflectors.

    real(kind=real64), intent(out), optional, allocatable, target, dimension(:,:) :: qr

    The M-by-N factored matrix stored such that the elements on and above the diagonal contain the MIN(M, N)-by-N upper trapezoidal matrix ( is upper triangular if M >= N). The elements below the diagonal, along with the array tau, represent the orthogonal matrix as a product of elementary reflectors.

    real(kind=real64), intent(out), optional, allocatable, target, dimension(:,:) :: q

    The M-by-M orthogonal matrix .

    real(kind=real64), intent(out), optional, allocatable, target, dimension(:,:) :: r

    The M-by-N upper trapezoidal matrix .

    real(kind=real64), intent(out), optional, allocatable, target, dimension(:,:) :: p

    The N-by-N column-pivot tracking matrix where .

  • private pure subroutine qr_factor_pivot_cmplx(a, jpvt, tau, qr, q, r, p)

    Computes the QR factorization of an M-by-N matrix using column pivoting such that .

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=real64), intent(in), dimension(:,:) :: a

    The M-by-N matrix to factor.

    integer(kind=int32), intent(inout), dimension(:) :: jpvt

    On input, an N-element array that if JPVT(I) .ne. 0, the I-th column of A is permuted to the front of A * P; if JPVT(I) = 0, the I-th column of A is a free column. On output, if JPVT(I) = K, then the I-th column of A * P was the K-th column of A.

    complex(kind=real64), intent(out), optional, allocatable, target, dimension(:) :: tau

    A MIN(M, N)-element array used to store the scalar factors of the elementary reflectors.

    complex(kind=real64), intent(out), optional, allocatable, target, dimension(:,:) :: qr

    The M-by-N factored matrix stored such that the elements on and above the diagonal contain the MIN(M, N)-by-N upper trapezoidal matrix ( is upper triangular if M >= N). The elements below the diagonal, along with the array tau, represent the orthogonal matrix as a product of elementary reflectors.

    complex(kind=real64), intent(out), optional, allocatable, target, dimension(:,:) :: q

    The M-by-M orthogonal matrix .

    complex(kind=real64), intent(out), optional, allocatable, target, dimension(:,:) :: r

    The M-by-N upper trapezoidal matrix .

    complex(kind=real64), intent(out), optional, allocatable, target, dimension(:,:) :: p

    The N-by-N column-pivot tracking matrix where .

public interface qr_rank1_update

  • private pure subroutine qr_rank1_update_dbl(q, r, u, v)

    Computes the rank-1 update to an M-by-N QR factored matrix where , , and such that .

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(inout), dimension(:,:) :: q

    On input, the original M-by-K orthogonal matrix . On output, the updated matrix .

    real(kind=real64), intent(inout), dimension(:,:) :: r

    On input, the M-by-N matrix . On output, the updated matrix .

    real(kind=real64), intent(in), dimension(:) :: u

    The M-element update vector.

    real(kind=real64), intent(in), dimension(:) :: v

    The N-element update vector.

  • private pure subroutine qr_rank1_update_cmplx(q, r, u, v)

    Computes the rank-1 update to an M-by-N QR factored matrix where , , and such that .

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=real64), intent(inout), dimension(:,:) :: q

    On input, the original M-by-K orthogonal matrix . On output, the updated matrix .

    complex(kind=real64), intent(inout), dimension(:,:) :: r

    On input, the M-by-N matrix . On output, the updated matrix .

    complex(kind=real64), intent(in), dimension(:) :: u

    On input, the M-element update vector. On output, the original content of the array is overwritten.

    complex(kind=real64), intent(in), dimension(:) :: v

    On input, the N-element update vector. On output, the original content of the array is overwritten.

public interface solve_qr

  • private pure function solve_qr_no_pivot_mtx(a, tau, b) result(x)

    Solves a system of M QR-factored equations of N unknowns. M must be greater than or equal to N.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in), dimension(:,:) :: a

    The M-by-N QR factored matrix as returned by qr_factor.

    real(kind=real64), intent(in), dimension(:) :: tau

    A MIN(M, N)-element array containing the scalar factors of the elementary reflectors as returned by qr_factor.

    real(kind=real64), intent(in), dimension(:,:) :: b

    The M-by-NRHS right-hand-side matrix.

    Return Value real(kind=real64), allocatable, dimension(:,:)

    The N-by-NRHS solution matrix.

  • private pure function solve_qr_no_pivot_mtx_cmplx(a, tau, b) result(x)

    Solves a system of M QR-factored equations of N unknowns. M must be greater than or equal to N.

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=real64), intent(in), dimension(:,:) :: a

    The M-by-N QR factored matrix as returned by qr_factor.

    complex(kind=real64), intent(in), dimension(:) :: tau

    A MIN(M, N)-element array containing the scalar factors of the elementary reflectors as returned by qr_factor.

    complex(kind=real64), intent(in), dimension(:,:) :: b

    The M-by-NRHS right-hand-side matrix.

    Return Value complex(kind=real64), allocatable, dimension(:,:)

    The N-by-NRHS right-hand-side matrix.

  • private pure function solve_qr_no_pivot_vec(a, tau, b) result(x)

    Solves a system of M QR-factored equations of N unknowns. M must be greater than or equal to N.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in), dimension(:,:) :: a

    The M-by-N QR factored matrix as returned by qr_factor.

    real(kind=real64), intent(in), dimension(:) :: tau

    A MIN(M, N)-element array containing the scalar factors of the elementary reflectors as returned by qr_factor.

    real(kind=real64), intent(in), dimension(:) :: b

    The M-element right-hand-side vector.

    Return Value real(kind=real64), allocatable, dimension(:)

    The N-element solution vector.

  • private pure function solve_qr_no_pivot_vec_cmplx(a, tau, b) result(x)

    Solves a system of M QR-factored equations of N unknowns. M must be greater than or equal to N.

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=real64), intent(in), dimension(:,:) :: a

    The M-by-N QR factored matrix as returned by qr_factor.

    complex(kind=real64), intent(in), dimension(:) :: tau

    A MIN(M, N)-element array containing the scalar factors of the elementary reflectors as returned by qr_factor.

    complex(kind=real64), intent(in), dimension(:) :: b

    The M-element right-hand-side vector.

    Return Value complex(kind=real64), allocatable, dimension(:)

    The N-element solution vector.

  • private pure function solve_qr_pivot_mtx(a, tau, jpvt, b) result(x)

    Solves a system of M QR-factored equations of N unknowns.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in), dimension(:,:) :: a

    The M-by-N QR factored matrix as returned by qr_factor.

    real(kind=real64), intent(in), dimension(:) :: tau

    A MIN(M, N)-element array containing the scalar factors of the elementary reflectors as returned by qr_factor.

    integer(kind=int32), intent(in), dimension(:) :: jpvt

    An N-element array, as output by qr_factor, used to track the column pivots.

    real(kind=real64), intent(in), dimension(:,:) :: b

    The MAX(M, N)-by-NRHS right-hand-side matrix.

    Return Value real(kind=real64), allocatable, dimension(:,:)

    The N-by-NRHS solution matrix.

  • private pure function solve_qr_pivot_mtx_cmplx(a, tau, jpvt, b) result(x)

    Solves a system of M QR-factored equations of N unknowns.

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=real64), intent(in), dimension(:,:) :: a

    The M-by-N QR factored matrix as returned by qr_factor.

    complex(kind=real64), intent(in), dimension(:) :: tau

    A MIN(M, N)-element array containing the scalar factors of the elementary reflectors as returned by qr_factor.

    integer(kind=int32), intent(in), dimension(:) :: jpvt

    An N-element array, as output by qr_factor, used to track the column pivots.

    complex(kind=real64), intent(in), dimension(:,:) :: b

    The M-by-NRHS right-hand-side matrix.

    Return Value complex(kind=real64), allocatable, dimension(:,:)

    The N-by-NRHS solution matrix.

  • private pure function solve_qr_pivot_vec(a, tau, jpvt, b) result(x)

    Solves a system of M QR-factored equations of N unknowns.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in), dimension(:,:) :: a

    The M-by-N QR factored matrix as returned by qr_factor.

    real(kind=real64), intent(in), dimension(:) :: tau

    A MIN(M, N)-element array containing the scalar factors of the elementary reflectors as returned by qr_factor.

    integer(kind=int32), intent(in), dimension(:) :: jpvt

    An N-element array, as output by qr_factor, used to track the column pivots.

    real(kind=real64), intent(in), dimension(:) :: b

    The M-element right-hand-side vector.

    Return Value real(kind=real64), allocatable, dimension(:)

    The N-element solution vector.

  • private pure function solve_qr_pivot_vec_cmplx(a, tau, jpvt, b) result(x)

    Solves a system of M QR-factored equations of N unknowns.

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=real64), intent(in), dimension(:,:) :: a

    The M-by-N QR factored matrix as returned by qr_factor.

    complex(kind=real64), intent(in), dimension(:) :: tau

    A MIN(M, N)-element array containing the scalar factors of the elementary reflectors as returned by qr_factor.

    integer(kind=int32), intent(in), dimension(:) :: jpvt

    An N-element array, as output by qr_factor, used to track the column pivots.

    complex(kind=real64), intent(in), dimension(:) :: b

    The M-element right-hand-side vector.

    Return Value complex(kind=real64), allocatable, dimension(:)

    The N-element solution vector.